{smcl}
{* *! version 1.4 22july2021}

{cmd:help aistata {stata "help cnuse_cn": 中文版本}}
{hline}
  aistata - Import data files into Stata
{hline}
{title: Description}
  The `aistata` command allows users to import data files into Stata from local storage or a specified URL. It supports various file formats, including .dta, .csv, .xls, .xlsx, and .txt. If no file extension is provided, the command assumes the file is in .dta format.

{title: Syntax}
  {cmd:aistata} {it:FileName} [, {cmd:clear} {cmd:nodesc} {cmd:save} {cmd:replace} {cmd:url(string)}]

{title: Options}
  {opt clear}         Specifies that the current data in memory should be cleared before loading the new data.
  
  {opt nodesc}       Suppresses the automatic description of the dataset upon loading.
  
  {opt save}         Saves the imported data to a specified local file. If the file already exists, the user will be prompted unless the `replace` option is specified.
  
  {opt replace}      Overwrites an existing file if it already exists when using the `save` option.
  
  {opt url(string)}  Specifies a custom URL for downloading the data file. If not provided, the default URL will be used: 
                     .

{title: Examples}
  {phang}  {cmd:aistata smoking, clear}  
           Imports the file `smoking.dta` from the default location or from the specified URL, clearing any existing data in memory.

  {phang}  {cmd:aistata mydata.csv, nodesc}  
           Imports the file `mydata.csv` and suppresses the automatic description of the dataset.

  {phang}  {cmd:aistata mydata.txt, clear save("mydata_saved.txt")}  
           Imports the file `mydata.txt`, clears existing data, and saves the imported data as `mydata_saved.txt`.

  {phang}  {cmd:aistata mydata, clear url("http://example.com/mydata.dta")}  
           Assumes the file is `mydata.dta`, clears existing data, and attempts to download it from the specified URL.

{title: Error Handling}
  The command provides error messages in case of issues, such as missing file names, unsupported formats, or problems during file download or loading. If the specified file does not exist and cannot be downloaded, the command will terminate with an error message.

{title: Notes}
  - Ensure that the specified file exists in the local directory or at the provided URL.
  - The command automatically sets time series data if applicable.
  - Use the `save` option cautiously to avoid overwriting important files.

{hline}
